<%-- 
    Document   : FrVerVentas
    Created on : 13-12-2013, 12:08:49 PM
    Author     : moises
--%>

<%@page import="libreriaTicket.dao.DaoVenta"%>
<%@page import="libreriaTicket.entity.Venta"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <link href="publico/css/bootstrap-theme.min.css" rel="stylesheet" media="screen">
        <link href="publico/css/bootstrap.css" rel="stylesheet" media="screen">
        <script src="publico/script/jquery-1.9.1.js" type="text/javascript"></script>
        <script src="js/bootstrap.min.js" type="text/javascript"></script>
    </head>
    <body>
        
        
          <%
            String valor =(String)session.getAttribute("nombre");
                if(valor!=null){
                    %><jsp:include page="ingresado.jsp" flush="true"/><%
                }else{
                    %><jsp:include page="menu.html" flush="true"/><%
                }
            %>
        <div class="container">
            <div class="left">
                <div class="btn-group-vertical">
                    <a href="FrRegion.jsp"><button type="button" class="btn btn-default">Regiones</button></a>
                    <a href="FrComuna.jsp"><button type="button" class="btn btn-default">Comunas</button></a>
                    <a href="FrVerVentas.jsp"><button type="button" class="btn btn-default">Ventas</button></a>
                </div>

            </div>
        </div>
        <table class="table">
            <thead>
                <tr>
                    <th>ID Venta</th>
                    <th>fecha</th>
                    <th>total</th>
                    <th>usuario</th>
                </tr>
            </thead>
            <tbody>
                <% 
                    ArrayList<Venta> ventas  = DaoVenta.sqlSelectAll();
                    
                    for(Venta v : ventas){
                        out.write("<tr>");
                        out.write("<td>");
                        out.write(String.valueOf(v.getIdVenta()));
                        out.write("</td>");
                        out.write("<td>");
                        out.write(String.valueOf(v.getFechaVenta()));
                        out.write("</td>");
                        out.write("<td>");
                       
                        out.write(String.valueOf(v.getPrecioTotal()));
                        out.write("</td>");
                        out.write("<td>");
                        out.write(String.valueOf(v.getUsuario().getUsuario()));
                        out.write("</td>");
                        out.write("</tr>");
                    }
                    
                    
                %>
            </tbody>
        </table>
    </body>
</html>
